//////////////////////////////////////////////////////////////////////////
//
// GAM203
// Math Helper
// Math.h
// 
// Grant Johnson
// Qantm College
// 27/10/2010
//
//////////////////////////////////////////////////////////////////////////

#ifndef MESHBASIC_H
#define MESHBASIC_H

#include "Drawable.h"

#include <d3d9.h>
#include <d3d9types.h>

struct IDirect3DDevice9;
struct ID3DXMesh;

class MeshBasic : public Drawable
{
public:
	MeshBasic();
	virtual ~MeshBasic();
	
	//////////////////////////////////////////////////////////////////////////
	// VIRTUAL - Inherited from Drawable
	// For creating the drawable object
	//
	// Paramaters:
	// a_pDevice, the direct3d device
	// a_pTexFileName, a path passed into the function. This can either be used for
	// the texture file name, or for a mesh's file name.
	//
	// Returns false if any step of the creation failed
	// Returns true if created successfully
	//
	//////////////////////////////////////////////////////////////////////////
	virtual bool CreateObject(IDirect3DDevice9* a_pDevice, char* a_pTexFileName);

	//////////////////////////////////////////////////////////////////////////
	// VIRTUAL - Inherited from Drawable
	// For rendering the drawable object
	//
	// Paramaters:
	// a_pDevice, the direct3d device
	//
	// Returns void
	//
	//////////////////////////////////////////////////////////////////////////
	virtual void Render(float a_dt, IDirect3DDevice9* a_pDevice, const RenderParams& a_renderParams);

	//////////////////////////////////////////////////////////////////////////
	// Set the material used by the Mesh
	//
	// Paramaters:
	// a_mat, a material pointer to set as the new material
	//
	// Returns void
	//
	//////////////////////////////////////////////////////////////////////////
	void SetMaterial(D3DMATERIAL9* a_mat) { m_mtl = *a_mat; }

private:
	//Mesh used by the drawable
	ID3DXMesh* m_pMesh;

	//Material used in conjuction with the mesh
	D3DMATERIAL9 m_mtl;

	//Rotation angle of the mesh
	float m_angle;
};

#endif //MESHBASIC_H